package cn.fl.mcr.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.mcr.dto.McrLoanAccBalanceDTO;
import cn.fl.mcr.vo.McrLoanAccBalanceVO;


 /**
 * @Description: 信托账户余额变更记录 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrLoanAccBalanceVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrLoanAccBalanceDTO
	 * @return McrLoanAccBalanceVO
	 */
	public static McrLoanAccBalanceVO toVO(McrLoanAccBalanceDTO dto) {
		McrLoanAccBalanceVO  vo = null;
		if (dto != null) { 
			vo = new McrLoanAccBalanceVO();
			vo.setId(dto.getId());
			vo.setAccountId(dto.getAccountId());//账户ID
			vo.setFrontBalance(dto.getFrontBalance());//账户余额（更新前）
			vo.setAfterBalance(dto.getAfterBalance());//账户余额（更新后）
			vo.setIsValid(dto.getIsValid());//是否有效
			vo.setIsDel(dto.getIsDel());//是否删除

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
			vo.setFrontAvailable(dto.getFrontAvailable());
			vo.setAfterAvailable(dto.getAfterAvailable());
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrLoanAccBalanceVO
	 * @return McrLoanAccBalanceDTO
	 */
	public static McrLoanAccBalanceDTO toDTO(McrLoanAccBalanceVO vo) {
		McrLoanAccBalanceDTO dto = null;
		if (vo != null) {
			dto = new McrLoanAccBalanceDTO();
			dto.setId(vo.getId());
			dto.setAccountId(vo.getAccountId());//账户ID
			dto.setFrontBalance(vo.getFrontBalance());//账户余额（更新前）
			dto.setAfterBalance(vo.getAfterBalance());//账户余额（更新后）
			dto.setIsValid(vo.getIsValid());//是否有效
			dto.setIsDel(vo.getIsDel());//是否删除

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
			dto.setFrontAvailable(vo.getFrontAvailable());
			dto.setAfterAvailable(vo.getAfterAvailable());
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<McrLoanAccBalanceDTO>
	 * @return List<McrLoanAccBalanceVO>
	 */
	public static List<McrLoanAccBalanceVO> toVOList(List<McrLoanAccBalanceDTO> list) {
		List<McrLoanAccBalanceVO>  voList = new ArrayList<McrLoanAccBalanceVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrLoanAccBalanceDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrLoanAccBalanceVO>
	 * @return List<McrLoanAccBalanceDTO>
	 */
	public static List<McrLoanAccBalanceDTO> toDTOList(List<McrLoanAccBalanceVO> list) {
		List<McrLoanAccBalanceDTO>  dtoList = new ArrayList<McrLoanAccBalanceDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrLoanAccBalanceVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
